package com.example.eci_quartz.cloudcc.commcon;
import java.nio.charset.StandardCharsets;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;

public class ReplaceNameUtil {
	public String getNewName(String khdm, String name) {
		String newName="";
		try {
			String oldName="";
			//获取
			oldName=isValidate("oldnames",khdm);
			if(name.equals(oldName)){
				newName=isValidate("newnames",khdm);
			}else{
				newName=name;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return newName;
	}
	public String isValidate(String propertiesName,String khdm) {
		ResourceBundle bundle = null;
		String name="";
		try {
			bundle = PropertyResourceBundle.getBundle(propertiesName);
			name = new String(bundle.getString(khdm).getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
		} catch (Exception e) {
			name="";
		}
		return name;
	}
}
